<%--
  Created by IntelliJ IDEA.
  User: 唐僧骑马洗头
  Date: 2021/8/12
  Time: 9:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path=request.getContextPath();%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 移动端预览 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>请登录</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/me.css">
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <style>
        a{
            margin: 0;
            display: inline-block;
            width: 188px;
            height: 41.13px;
            line-height: 41.13px;
        }
    </style>
</head>
<body>
<br/>
<br/>
<br/>

<div class="m-container-small m-padded-tb-massive" style="max-width: 30em !important;">
    <div class="ur container">
        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui teal image header">
                    <img src="${pageContext.request.contextPath}/images/login_logo.png" class="image">
                    <div class="content">
                        学生住宿管理系统
                    </div>
                </h2>
                <form class="ui form large" method="post" action="${pageContext.request.contextPath}/student/login">
                    <div class="ui stacked segment">
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user icon"></i>
                                <input type="text" name="username" placeholder="用户名">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="password" placeholder="密码">
                            </div>
                        </div>
                        <div class="two fields">
                            <div class="field">
                                <button class="ui fluid large teal submit button">登   录</button>
                            </div>
                            <div class="field">
                                <button class="ui fluid large orange button" style="padding: 0">
                                    <a href="${pageContext.request.contextPath}/student/to_visit" style="color: white">我只是一个过客</a>
                                </button>
                            </div>
                        </div>
                    </div>

                    <div class="ui error mini message"></div>
                    <div id="userError" class="ui mini negative message" style="display:none">用户名或者密码错误，请重新输入</div>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.js"></script>

<script>

    var str = '${message}';
    console.log("===>"+str);
    if(str ==1){
        document.getElementById("userError").style.display="block";
    }




    $('.ui.form').form({
        fields: {
            username: {
                identifier: 'username',
                rules: [{
                    type: 'empty',
                    prompt: '请输入用户名'
                }]
            },
            password: {
                identifier: 'password',
                rules: [{
                    type: 'empty',
                    prompt: '请输入密码'
                }]
            }
        }
    });

    $('.ui.checkbox').checkbox();   //使得单选框可以被选中

</script>
</body>
</html>
